﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;


namespace QuanLyHocBongSinhVien.DAO
{
  public  class ChiTiet_DAO
    {
      dbConnection db = new dbConnection();
      public DataTable getAllChiTiet()
      {
          return db.ExecuteQuery("select * from CHITIETHBSV");
      }

      public void ThemCT(string mhb, string mmhb, string msv, int st, DateTime tg)
      {
          SqlParameter[] mang = new SqlParameter[5];
          mang[0] = new SqlParameter("@mahb",mhb);
          mang[1] = new SqlParameter("@mamuchb", mmhb);
          mang[2] = new SqlParameter("@masv", msv);
          mang[3] = new SqlParameter("@sotien", st);
          mang[4] = new SqlParameter("@thoigian", tg);
          db.ExecuteNonQuery("ThemChiTietHocBong", mang);
      }

      public void SuaCT(string mhb, string mmhb, string msv, int st, DateTime tg)
      {
          SqlParameter[] mang = new SqlParameter[5];
          mang[0] = new SqlParameter("@mahb", mhb);
          mang[1] = new SqlParameter("@mamuchb", mmhb);
          mang[2] = new SqlParameter("@masv", msv);
          mang[3] = new SqlParameter("@sotien", st);
          mang[4] = new SqlParameter("@thoigian", tg);
          db.ExecuteNonQuery("SuaChiTietHB", mang);
      }

      public void XoaCT(string mhb, string mmhb, string msv)
      {
          SqlParameter[] mang = new SqlParameter[3];
          mang[0] = new SqlParameter("@mahb", mhb);
          mang[1] = new SqlParameter("@mamuchb", mmhb);
          mang[2] = new SqlParameter("@masv", msv);
          db.ExecuteNonQuery("Xoa_ChiTietHB", mang);
      }

      public void Tk_MaHB(string mhb)
      {
          SqlParameter[] mang = new SqlParameter[1];
          mang[0] = new SqlParameter("@mahb", mhb);
          db.ExecuteNonQuery("timKiem_MaHBChitietHB", mang);
      }
      public void Tk_MaMucHB(string mhb)
      {
          SqlParameter[] mang = new SqlParameter[1];
          mang[0] = new SqlParameter("@mamuchb", mhb);
          db.ExecuteNonQuery("timKiem_MaMucChitietHB", mang);
      }

      public void Tk_MaSV(string mhb)
      {
          SqlParameter[] mang = new SqlParameter[1];
          mang[0] = new SqlParameter("@masv", mhb);
          db.ExecuteNonQuery("timKiem_MaSVChitietHB", mang);
      }

      public void Tk_SoTien(int mhb)
      {
          SqlParameter[] mang = new SqlParameter[1];
          mang[0] = new SqlParameter("@sotien", mhb);
          db.ExecuteNonQuery("timKiem_STChitietHB", mang);
      }
      public void Tk_ThoiGian(DateTime mhb)
      {
          SqlParameter[] mang = new SqlParameter[1];
          mang[0] = new SqlParameter("@thoigian", mhb);
          db.ExecuteNonQuery("timKiem_TGChitietHB", mang);
      }
    
    }
}
